package com.xmall.pethouse_api.mapper;

import com.xmall.pethouse_api.pojo.entity.Order;
import com.xmall.pethouse_api.pojo.vo.OrderVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import java.util.List;

@Mapper
public interface OrderMapper {
    // 查询当前用户的所有订单
    @Select("SELECT * FROM orders WHERE user_id = #{userId} ORDER BY created_at DESC")
    List<Order> findByUserId(Long userId);

    // 联表查询订单VO
    List<OrderVO> findOrderVOByUserId(Long userId);

    void insert(Order order);
} 